{#include file="top.php"#}
<script type="text/javascript">
    function ajax_share_report_ponits(id,action_name,remark){
        $.ajax({
            url : '/ajax_points.php?action=ajax_fb_points',
            type : 'POST',
            data: "id="+id+"&code={#php#}echo md5('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'imoreHK');{#/php#}&action_name="+action_name+"&remark="+remark,
            dataType : 'json',
            success: function(data){
                if(data.ret==0){
                    // console.info("未登入");
                }else if(data.ret==1){
                    if(data.data.ret==1){
                        // console.info(data.data.action);
                    }else{
                        //  console.info(data.data.reason);
                    }

                }else{
                    // console.info(data.reason);
                }
            }
        });
        var fb_count = 0;
        fb_count = parseInt($('#fb_count_'+id).html())+1;
        $('#fb_count_'+id).html(fb_count);
    }
    function apply(pid){
        $.getJSON("/product.php?action=ajax&t=11",{pid:pid},function(data){
            if(parseInt(data.login)==1){
                if(parseInt(data.email)==1){
                    if(parseInt(data.limit)==1){
                        if(parseInt(data.s)==1 || parseInt(data.s)==4 || parseInt(data.s)==5){
                            //showpop(data.msg);
                            window.location.href="{#optimize_url('product', 'report_add', 'mtype=1&pid='|cat:$pid)#}";
                        }else if(parseInt(data.s)==2 || parseInt(data.s)==3){
                            window.location.href='/member_center.php?action=report';
                        }
                    }else{
                        $("#popupText").html("你還未成為試用專員，<a href='/member.php?action=regTrial&toURL={#$thisUrl#}'>立即申請</a>！");
                        showLB('dialog_popup',0);
                    }
                }else{
                    $("#popupText").html("您的電郵地址尚未驗證，請先激活！<a class='pink' href='/member.php?action=resendActivation' target='_blank'>重發激活郵件</a>");
                    showLB('dialog_popup',0);
                }
            }else{
                $("#loginText").text("iTRIAL 會員登入 REGISTRATION");
                $("#login").attr("onClick","login('show_my_pic();apply("+pid+")')");
                $("#login_type").attr("onClick","fnblogin('show_my_pic();apply("+pid+")')");
                showLB('#dialog',0);
            }
        });
    }
    function gopage(rid){
        if(rid){
            window.location.href="/trialist/report-detail-{#$pid#}-"+rid+".html";
        }
    }

    function showre(id,s,p){
        var c = $('#remsg'+id).attr('c');
        if(c==1){
            $('#remsg'+id).attr('c',0);
            //$("#remsglist"+id).empty();
            hidere(id);
        }else{
            $('#remsg'+id).attr('c',1);
            $('#remsg'+id).show();
            if(s>0){
                var d = $('#remsg'+id).attr('d');
                if(d==0){
                    $('#remsg'+id).attr('d',1);
                    addmsg(id,p);
                }
            }
        }
        show_my_pic();
    }

    function hidere(id){
        $('#remsg'+id).hide();
    }

    function addmsg(id,p){
        $.getJSON("/product.php?action=ajax&t=1",{topid:id,page:p},function(data){
            $.each(data.result,function(idx,item){
                var htm = "";
                if(item.mid=={#$uid#} || (1=={#$reply_type#} && item.top_mid=={#$uid#})){
                    htm ='<span id="remove'+item.id+'"><span id="rev1_'+item.id+'"><a href="javascript:void(0);" onclick="removemsg('+item.id+','+item.topid+',0)" class="btn_s btn_s_remove"><strong>移除</strong></a></span></span>';
                }else{
                    htm='<a href="javascript:void(0);" onclick="inform('+item.id+','+item.id+')" class="btn_s btn_s_rep"><strong>舉報</strong></a>';
                }
                $("#remsglist"+id).prepend('<div id="msglistbody2_'+item.id+'" class="s_m_box"><figure class="img_box"><img src="'+item.photo_l+'" width=56 /></figure><div class="good"><a href="javascript:void(0);"  onclick="plikes2(\'comment\','+item.id+',1)" class="g1"><span id="msglikes'+item.id+'_1">'+item.likes+'</span></a><a href="javascript:void(0);"  onclick="plikes2(\'comment\','+item.id+',2)" class="g2"><span id="msglikes'+item.id+'_2">'+item.unlikes+'</span></a></div><strong class="name">'+item.username+'</strong><span>'+item.addtime+'</span>'+htm+'<p id="msgtxt'+item.id+'" e=0>'+item.body+'</p></div>');
                //$('#coun1').html(parseInt($('#coun1').attr('comments'))+1 + '則留言').attr('comments', parseInt($('#coun1').attr('comments'))+1);
            });
            if((data.pageinfo.pagecount-data.pageinfo.curpage)>0){
                $("#more"+id).html('<a href="javascript:void(0);" onclick="addmsg('+id+','+(p+1)+')">更多</a>');
            }
            if((data.pageinfo.pagecount-data.pageinfo.curpage)==0){
                $("#more"+id).empty();
            }
        });
    }

    function callback(content){
        switch(content['retcode']){
            case 1:
                $("#loginText").text("以iMORE帳戶登入");
                $("#login").attr("onClick","login('show_my_pic();')");
                $("#login_type").attr("onClick","fnblogin('show_my_pic();')");
                showLB('#dialog',0);
                break;
            case 2:
                //alert(content['msg']);
                $('#remsg'+content['data'].topid).attr('d',1);
                $("#message2_"+content['data'].topid).val('');
                $("#remsglist"+content['data'].topid).append('<div id="msglistbody2_'+content['data'].id+'" class="s_m_box"><figure class="img_box"><img src="'+content['data'].photo_l+'" width=56 /></figure><div class="good"><a href="javascript:void(0);"  onclick="plikes2(\'comment\','+content['data'].id+',1)" class="g1"><span id="msglikes'+content['data'].id+'_1">'+content['data'].likes+'</span></a><a href="javascript:void(0);"  onclick="plikes2(\'comment\','+content['data'].id+',2)" class="g2"><span id="msglikes'+content['data'].id+'_2">'+content['data'].unlikes+'</span></a></div><strong class="name">'+content['data'].username+'</strong><span>'+content['data'].addtime+'</span><span id="remove'+content['data'].id+'"><span id="rev1_'+content['data'].id+'"><a href="javascript:void(0);" onclick="removemsg('+content['data'].id+','+content['data'].topid+',0)" class="btn_s btn_s_remove"><strong>移除</strong></a></span></span><p id="msgtxt'+content['data'].id+'" e=0>'+content['data'].body+'</p></div>');


                $('#coun2_'+content['data'].topid).html('<a  href="javascript:void(0);" onclick="showre('+content['data'].topid+','+content['data'].sum+',1)" class="btn_s btn_s_reply"><strong>'+content['data'].sum+'回覆</strong></a>');
                $('#sum'+content['data'].topid).val(parseInt($('#sum'+content['data'].topid).val())+1);
                break;
            case 3:
                //alert(content['msg']);
                $("#msgbody").show();
                $("#message1").val('');
                $('#coun1').html(parseInt($('#coun1').attr('comments'))+1 + '則留言').attr('comments', parseInt($('#coun1').attr('comments'))+1);
                $("#msgcontent").prepend('<div class="s_m_box"  id="msglistbody1_'+content['data'].id+'"><figure class="img_box"><img src="'+content['data'].photo_l+'" width=56 /></figure><div class="good"><a href="javascript:void(0);"  class="g1" onclick="plikes2(\'comment\','+content['data'].id+',1)" id="msglikes'+content['data'].id+'_1">'+content['data'].likes+'</a><a href="javascript:void(0);"  class="g2" onclick="plikes2(\'comment\','+content['data'].id+',2)" id="msglikes'+content['data'].id+'_2">'+content['data'].unlikes+'</a></div><strong class="name">'+content['data'].username+'</strong><span>'+content['data'].addtime+'</span><span id="remove'+content['data'].id+'"><span id="rev1_'+content['data'].id+'"><a href="javascript:void(0);" onclick="removemsg('+content['data'].id+','+content['data'].topid+',1)" class="btn_s btn_s_remove"><strong>移除</strong></a></span></span><p id="msgtxt'+content['data'].id+'">'+content['data'].body+'</p><span  id="coun2_'+content['data'].id+'"><a id="coun2_'+content['data'].id+'" href="javascript:void(0);" onclick="showre('+content['data'].id+','+content['data'].sum+',1)" class="btn_s btn_s_reply"><strong>'+content['data'].sum+'回覆</strong></a></span><div id="remsg'+content['data'].id+'" style="display:none" c=0 d=0><div id="remsglist'+content['data'].id+'"></div><div id="more'+content['data'].id+'"></div><form id="form'+content['data'].id+'" name="form'+content['data'].id+'" action="/product.php?action=ajax&t=2" method="post" target="iframe1"><input type="hidden" name="rid" value="'+content['data'].oid+'"/><input type="hidden" name="linkid" value="'+content['data'].id+'"/><input type="hidden" id="sum'+content['data'].id+'" name="sum" value="'+content['data'].sum+'"/><div class="s_m_box s_m_box_ta"><figure class="img_box"><img src="{#$photo#}" e=1 width=56 /></figure><div class="ta"><textarea id="message2_'+content['data'].id+'" name="message"></textarea></div><a href="javascript:void(0);" onclick="form'+content['data'].id+'.submit();" class="btn_s btn_s_cri"><strong>評論</strong></a></div></form></div></div>');

                break;
            default:
                break;
            }
        }

        function isremove(id,is){
            if(is==0){
                $("#rev1_"+id).hide();
                $("#rev2_"+id).show();
            }else{
                $("#rev1_"+id).show();
                $("#rev2_"+id).hide();
            }
        }

        function removemsg(id,topid,is){
            var sum = parseInt($('#sum'+topid).val());
            $.post("/product.php?action=ajax&t=5",{id:id,topid:topid,sum:sum,is:is},function(data){
                //alert(data+'|'+is);
                if(data){
                    if(is){
                        $("#msglistbody1_"+id).remove();

                        $('#coun1').html(parseInt($('#coun1').attr('comments'))-1 + '則留言').attr('comments', parseInt($('#coun1').attr('comments'))-1);
                    }else{
                        $("#msglistbody2_"+id).remove();
                        $('#coun2_'+topid).html('<a  href="javascript:void(0);" onclick="showre('+topid+','+(parseInt($('#sum'+topid).val())-1)+',1)" class="btn_s btn_s_reply"><strong>'+(parseInt($('#sum'+topid).val())-1)+'回覆</strong></a>');
                        $('#sum'+topid).val(parseInt($('#sum'+topid).val())-1);
                    }
                }
            });
        }

        function plikes(sec,sid){
            $.getJSON("/product.php?action=ajax&t=3",{sec:sec,sid:sid},function(data){
                if(parseInt(data.recode)==1){
                    $('#'+sec+'_likes_'+sid).html(data.likes);
                }else if(parseInt(data.recode)==2){
                    $("#loginText").text("以iMORE帳戶登入");
                    $("#login").attr("onClick","login('show_my_pic();plikes(\\'"+sec+"\\',"+sid+")')");
                    $("#login_type").attr("onClick","fnblogin('show_my_pic();plikes(\\'"+sec+"\\',"+sid+")')");
                    showLB('#dialog',0);
                }else{
                    showpop(data.msg);
                }
            });
        }

        function plikes2(sec,sid,type){
            $.getJSON("/product.php?action=ajax&t=3",{sec:sec,sid:sid,type:type},function(data){
                if(parseInt(data.recode)==1){
                    $('#msglikes'+sid+'_'+type).html(data.likes);
                }else if(parseInt(data.recode)==2){
                    $("#loginText").text("以iMORE帳戶登入");
                    $("#login").attr("onClick","login('show_my_pic();plikes2(\\'"+sec+"\\',"+sid+","+type+")')");
                    $("#login_type").attr("onClick","fnblogin('show_my_pic();plikes2(\\'"+sec+"\\',"+sid+","+type+")')");
                    showLB('#dialog',0);
                }else{
                    showpop(data.msg);
                }
            });
        }

        function inform(id,mid){
            $.getJSON("/product.php?action=ajax&t=4",{id:id,mid:mid},function(data){
                if(parseInt(data.recode)==1){
                    $("#msgtxt"+id).prepend("<p class='warn'>感謝你向 iMORE 舉報不當行為！</p>");
                }else if(parseInt(data.recode)==0){
                    $("#loginText").text("以iMORE帳戶登入");
                    $("#login").attr("onClick","login('show_my_pic();inform("+id+","+mid+")')");
                    $("#login_type").attr("onClick","fnblogin('show_my_pic();inform("+id+","+mid+")')");
                    showLB('#dialog',0);
                }else{
                    showpop(data.msg);
                }
            });
        }

		/* function fb_recommend(sec,sid){
            $.getJSON("/product.php?action=ajax&t=12",{sec:sec,sid:sid},function(data){
                if(parseInt(data.recode)==1){
                    $('#fb_recommend').html(data.likes);
                }else if(parseInt(data.recode)==2){
                    $("#loginText").text("以iMORE帳戶登入");
                    $("#login").attr("onClick","login('show_my_pic();fb_recommend(\\'"+sec+"\\',"+sid+")')");
                    $("#login_type").attr("onClick","fnblogin('show_my_pic();fb_recommend(\\'"+sec+"\\',"+sid+")')");
                    showLB('#dialog',0);
                }else{
                    showpop(data.msg);
                }
            });
        } */


        function login(func){

            var email = $('#email').val();
            if($.trim(email).length==0){
                $('#email_tip').show();
                $('#email').focus();
                return false;
            }
            var password = $('#password').val();
            if($.trim(password).length==0){
                $('#password_tip').show();
                $('#password').focus();
                return false;
            }
            /*
                var captcha = $('#captcha').val();
                if($.trim(captcha).length==0){
                        alert("{#$ERR_CAPTCHA#}");
                        $('#captcha').focus();
                        return false;
                }
             */

            $.getJSON("/member.php?action=ajax_login_imore",{email:email,password:password/*,captcha:captcha*/},function(data){
                if(parseInt(data.ret)==1){
                    showpop(data.msg);
                }else if(parseInt(data.ret)==2){
                    showpop(data.msg);
                }else{closeLB();memberBar();eval(func);}
            });
        }

        function login_fnb(func){
            var email = $('#email').val();
            if($.trim(email).length==0){
                $('#email_tip').show();
                $('#email').focus();
                return false;
            }
            var password = $('#password').val();
            if($.trim(password).length==0){
                $('#password_tip').show();
                $('#password').focus();
                return false;
            }
            /*
                var captcha = $('#captcha').val();
                if($.trim(captcha).length==0){
                        alert("{#$ERR_CAPTCHA#}");
                        $('#captcha').focus();
                        return false;
                }
             */


            $.getJSON("/member.php?action=ajax_login_fnb",{email:email,password:password/*,captcha:captcha*/},function(data){
                if(parseInt(data.ret)==1){
                    showpop(data.msg);
                }else if(parseInt(data.ret)==2){
                    showpop(data.msg);
                }else{closeLB();memberBar();eval(func);}
            });
        }

        function fnblogin(func){
            $("#loginText").text("F&amp;B 會員登入 REGISTRATION");
            $("#login").attr("onClick","login_fnb("+func+")");
            $("#login_type_text").text("以 iMORE 登入");
            $("#login_type").attr("onClick","itriallogin("+func+")");
            $("#loginTextName").css("background-position","0 -940px");
            $("#classlogo").attr("class","itrial ir");

        }
        function itriallogin(func){
            $("#loginText").text("iTRIAL 會員登入 REGISTRATION");
            $("#login").attr("onClick","login("+func+")");
            $("#login_type_text").text("以 F&B 登入");
            $("#login_type").attr("onClick","fnblogin("+func+")");
            $("#loginTextName").css("background-position","0 -900px");
            $("#classlogo").attr("class","fabtn ir");
        }

        function showLB(ct,n){
            var sh=$(document).height();
            var sw=$(document).width();
            var st=$(window).scrollTop();
            var ch=$(window).height();
            var cw=$(window).width();
            var tbT=(Number(ch)/3+Number(st))+"px";
            var tbL=(Number(cw)/2)+"px";
            if(n==0){
                $("#fullbg").css({width:sw,height:sh});
                $(ct).css({top:tbT,left:tbL});
                $("#fullbg").fadeTo('slow', 0.4);
                $(ct).fadeIn('slow');
                $(window).scroll(function(){showLB(ct,1)});
                $(window).resize(function(){showLB(ct,1)});
            }else{
                if($("#fullbg").css("display")=="block"){
                    $("#fullbg").css({width:sw,height:sh});
                    $(ct).css({top:tbT,left:tbL});
                }
            }
        }


        function closeLB(){
            $("#fullbg").fadeOut('slow');
            $('#dialog').fadeOut('slow');
            $("#dialog_popup").fadeOut('slow');
        }

        function user_like(uid){
            $.getJSON("/person.php?action=ajax&t=1",{uid:uid},function(data){
                if(parseInt(data.recode)==2){
                    var l = parseInt($('#user_likes').html());
                    $('#like_bt').html("<a href='javascript:void(0);' class='btn_black' onclick='user_unlike("+uid+")'>取消關注</a>");
                }else if(parseInt(data.recode)==1){
                    $("#loginText").text("以iMORE帳戶登入");
                    $("#login").attr("onClick","login('show_my_pic();user_like("+uid+");')");
                    $("#login_type").attr("onClick","fnblogin('show_my_pic();user_like("+uid+");')");
                    showLB('#dialog',0);
                }else{
                    showpop(data.msg);
                }
            });
        }

        function check_login(){
            $.get("/product.php?action=ajax&t=15",function(data){
                if(parseInt(data)==1){
                    $("#loginText").text("以iMORE帳戶登入");
                    $("#login").attr("onClick","login('show_my_pic();')");
                    $("#login_type").attr("onClick","fnblogin('show_my_pic();')");
                    showLB('#dialog',0);
                }
            });
        }
        function show_my_pic(){
            $.get("/product.php?action=ajax&t=14",function(data){
                $('[e=1]').attr('src',data);
            });
        }

        function user_unlike(uid){
            $.getJSON("/person.php?action=ajax&t=2",{uid:uid},function(data){
                if(parseInt(data.recode)==2){
                    var l = parseInt($('#user_likes').html());
                    $('#like_bt').html("<a href='javascript:void(0);' class='btn_pink' onclick='user_like("+uid+")'>關注</a>");
                }else if(parseInt(data.recode)==1){
                    $("#loginText").text("以iMORE帳戶登入");
                    $("#login").attr("onClick","login('show_my_pic();user_unlike("+uid+")')");
                    $("#login_type").attr("onClick","fnblogin('show_my_pic();user_unlike("+uid+")')");
                    showLB('#dialog',0);
                }else{
                    showpop(data.msg);
                }
            });
        }

        $(function() {
            $('.img_lightbox').lightBox();
        });
</script>


<div class="body">
    <div class="main">
        <div class="crumb">
            <a href="{#optimize_url('product', 'invite_list', 'mtype=1')#}">試用專區</a> &gt;
            <a href="{#optimize_url('product', 'readReport_list', 'mtype=1')#}">試用報告</a> &gt;
            <strong>{#$product.type_name#} - {#$product.name#}</strong>
        </div>
        <div class="b_box b_box_t_rep">
            <div class="hd">
                <h2 class="hd_title">試用報告</h2>
            </div>
            <div class="bd">
					<figure class="img_box"><p class="img_p"><a class="img_lightbox" title="{#$product.cname#}" href="/{#$product.cover#}"><span><img src="{#$product._photo_url#}"></span></a></p>
                    <div class="product_scroce">
                        <i class="scorce">{#$product._overall#}</i>
                        <span>分</span>
                    </div></figure>
                <h2 class="title_en">{#$product.type_name#} </h2>
                <h3 class="title_cn" style='margin-bottom:0px;'>{#$product.name#}</h3>
                <h3 class="title_cn">{#$product.cname#}</h3>
                <table>
                    {#foreach from=$product['_attr'] item=v key=k#}
                    <tr>
                        <th>{#$k#}</th>
                        <td class="td_m">：</td>
                        <td>{#$v#}</td>
                    </tr>
                    {#/foreach#}
                </table>
                {#if $product.is_report_add eq 1#}
                <a class="btn_s btn_s_report btn_s_emo" href="javascript:void(0);" onclick="apply({#$pid#})"><strong>發表心得</strong></a>
                {#else#}
                <a class="btn_no btn_s_report btn_s_emo"><strong>我要評鑑</strong></a>
                {#/if#}
                <a href="javascript:void(0);"   onclick="plikes('product',{#$pid#})" class="btn_like">
                    <span id='product_likes_{#$pid#}'>{#$product.likes#}</span> like
                    <em class="i">+1</em>
                </a>

            </div>
            {#if $product.apply_starttime>('2000-01-01') && $product.report_endtime#}
            <div class="ft">
                <span class="exp_span">試用期間 ：{#date('Y-m-d',strtotime($product.report_starttime))#} ~ {#date('Y-m-d',strtotime($product.report_endtime))#}</span>
                <span class="exp_span">試用日數 ：{#$product._diff_day#}日</span>
                <span>名額 ：{#$product['quota']#}個</span>
                {#if (!empty($product['capacity_trial']))#}<div><span class="exp_span">試用規格 ：{#$product['capacity_trial']#}</span></div>{#/if#}
            </div>
            {#/if#}
        </div>
        <div class="b_box b_box_pro_rep b_box_pro_rep_ss">
            <div class="hd">
                <h2 class="hd_title">試用評鑑報告</h2>
            </div>
            <div class="bd">
                <div class="box_hd">
                    <figure class="img_box avastar_box">
						<p class="img_p">
								<a href="{#optimize_url('person', 'report', 'username='|cat:$reports_list_res.username)#}"> <span><img src="{#$reports_list_res.photo_l#}" width=77>	 </span></a>
							</p> 
						
					</figure>
                    <h3 class="title"><a href="{#optimize_url('person', 'report', 'username='|cat:$reports_list_res.username)#}" >{#$reports_list_res.username#}</a></h3>
                    <p>年齡：{#$reports_list_res.agegroup_cname#}</p>
                    <p>臉部膚質：{#$reports_list_res.body_skin#}</p>
                    <span id="like_bt">
                        {#if $reports_list_res.islike==0#}
                        <a href="javascript:void(0);" class="btn_pink" onclick='user_like({#$reports_list_res.mid#})'>關注</a>
                        {#else#}
                        <a href="javascript:void(0);" class="btn_black" onclick='user_unlike({#$reports_list_res.mid#})'>取消關注</a>
                        {#/if#}
                    </span>
                    <em class="icon icon_master {#if $reports_list_res.user_type neq 5#}icon_master_g{#/if#}">{#if $reports_list_res.user_type neq 5#}試用專員{#else#}體驗達人{#/if#}</em>
                </div>
                <div class="box_mid">
                    <p>總評：{#if $reports_list_res.well==1#}很好{#else if $reports_list_res.well==2#}好{#else if $reports_list_res.well==3#}一般{#else if $reports_list_res.well==4#}差{#else if $reports_list_res.well==5#}很差{#/if#}</p>
                    <div class="star_box">
                        <table>
                            <tr>
                                {#foreach  from=$reports_list_res._category_score item=v1 key=k1#}
                                <th>{#$v1.v#}</th>
                                <td><strong class="star star_{#$v1.k#}">{#$v1.k#}星</strong></td>
                                {#if (($k1+1)%3) eq 0#}</tr><tr>{#/if#}
                                {#/foreach#}
                            </tr>
                        </table>
                        <br/>
                        <p class="que"><b>{#$reports_list_res.title#}</b></p>
                        <div class="btn_box_r">

                            <a href="javascript:void(0);" onclick="plikes('report',{#$reports_list_res.id#})" class="btn_pink">推介</a>
                            <span><a id='report_likes_{#$reports_list_res.id#}'>{#$reports_list_res.likes#}</a>個推介</span>
                            <div class="facebook_share">
                                <div class="count"><span class="count_button_nub"></span>
                                    <div  id="fb_count_{#$reports_list_res.id#}">{#$reports_list_res.fb_count#}</div></div>
                                <script>
                                        function postToFeed{#$reports_list_res.id#}(id) {
                                            // calling the API ...
                                            var obj = {
                                                method: 'feed',
                                                link: '{#php#}echo DOMAIN;{#/php#}{#substr($reports_list_res.share_url,1)#}',
                                                picture: '{#php#}echo DOMAIN;{#/php#}{#$product._photo_url#}',
                                                name: '{#str_replace("'","’",$reports_list_res.title)#}',
                                                caption: '{#str_replace("'","’",$product.cname)#}',
												description: '{#str_replace("'","’",str_replace(array("\r\n", "\n", "\r"),"",strip_tags(htmlspecialchars_decode($reports_list_res.body))))#}'
												
                                            };
                                            FB.ui(obj, function(response){
                                                if(response['post_id']){
                                                   var remark = "{#str_replace("'","’",$reports_list_res.title)#}"
                                                    ajax_share_report_ponits(id,"share_report",remark);
                                                }
                                            });
                                        }</script>
                                <a class="btn_fb_share"
                                   title="Share on Facebook"
                                   onclick="postToFeed{#$reports_list_res.id#}({#$reports_list_res.id#});" href="javascript:void(0);"></a>


                            </div>

                        </div>
                    </div>
                </div>
                <div class="box_bot">
                    <p>{#$reports_list_res.body#}</p>
                    {#foreach from=$reports_list_res._content item=v1 key=k1#}
                    {#if $v1.p#}
                    <a class="img_lightbox" title="{#htmlencode($v1.t)#}" href="/{#$v1.p#}">
                        <img src="/{#$v1.p#}" alt="pic" style='max-width:450px;' class="i" />
                    </a>
                    <p>{#$v1.t#}</p>
                    {#/if#}
                    {#/foreach#}
                </div>
            </div>
        </div>
        <div id='messagebox' name='messagebox' class="t_msg_box">
            <div class="hd" id="coun1" comments="{#$reports_list_res.comments#}">
                {#if !empty($reports_list_res.comments)#}{#$reports_list_res.comments#}則{#/if#}留言


            </div>
            <div class="bd">
                <div class="s_m_box s_m_box_ta">
                    <form id="forms" name="forms" action="/product.php?action=ajax&t=2" method="post" target="iframe1">
                        <input type="hidden" name="rid" value="{#$rid#}"/>
                        <input type="hidden" name="linkid" value="0"/>
                        <figure class="img_box">
                            <img src="{#$photo#}" e=1 width=56/>
                        </figure>
                        <div class="ta">
                            <textarea id="message1" name="message" onfocus="check_login()"></textarea>
                        </div>
                        <a href="javascript:void(0);" class="btn_s btn_s_cri" onclick="forms.submit();">
                            <strong>我要留言</strong>
                        </a>
                    </form>
                </div>
                <div id="msgcontent">　
                    {#foreach from=$reportsCommentList.result item=v2 key=k2#}

                    <div class="s_m_box"  id="msglistbody1_{#$v2.id#}">
                        <figure class="img_box">
                            <img src="{#$v2.photo_l#}" width=56 />
                        </figure>
                        <div class="good">
                            <a href="javascript:void(0);"  class="g1" onclick="plikes2('comment',{#$v2.id#},1)" id="msglikes{#$v2.id#}_1">{#$v2.likes#}</a>
                            <a href="javascript:void(0);"  class="g2" onclick="plikes2('comment',{#$v2.id#},2)" id="msglikes{#$v2.id#}_2">{#$v2.unlikes#}</a>
                        </div>
                        <strong class="name">{#$v2.username#}</strong>
                        <span>{#$v2.addtime#}</span>
                        {#if $v2.mid==$uid#}
                        <span id="remove{#$v2.id#}"><span id="rev1_{#$v2.id#}">
                                <a href="javascript:void(0);" onclick="removemsg({#$v2.id#},{#$v2.topid#},1)" class="btn_s btn_s_remove"><strong>移除</strong></a>
                            </span></span>
                        {#else#}
                        <a href="javascript:void(0);" onclick="inform({#$v2.id#},{#$v2.mid#})" class="btn_s btn_s_rep">
                            <strong>舉報</strong>
                        </a>
                        {#/if#}
                        <p id="msgtxt{#$v2.id#}">{#nl2br($v2.body)#}</p>
                        <span  id="coun2_{#$v2.id#}">
                            <a id="coun2_{#$v2.id#}" href="javascript:void(0);" onclick="showre({#$v2.id#},{#$v2.subComments#},1)" class="btn_s btn_s_reply">
                                <strong>{#$v2.subComments#}回覆</strong>
                            </a>
                        </span>
                        <div id="remsg{#$v2.id#}" style="display:none" c=0 d=0>
                            <div id="remsglist{#$v2.id#}"></div><div id="more{#$v2.id#}"></div>
                            <form id="form{#$v2.id#}" name="form{#$v2.id#}" action="/product.php?action=ajax&t=2" method="post" target="iframe1">
                                <input type="hidden" name="rid" value="{#$rid#}"/>
                                <input type="hidden" name="linkid" value="{#$v2.id#}"/>
                                <input type="hidden" id="sum{#$v2.id#}" name="sum" value="{#$v2.subComments#}"/>
                                <div class="s_m_box s_m_box_ta">
                                    <figure class="img_box">
                                        <img src="{#$photo#}" e=1 width=56 />
                                    </figure>
                                    <div class="ta">
                                        <textarea id="message2_{#$v2.id#}" name="message" onfocus="check_login()"></textarea>
                                    </div>
                                    <a href="javascript:void(0);" onclick="form{#$v2.id#}.submit();" class="btn_s btn_s_cri">
                                        <strong>評論</strong>
                                    </a>
                                </div>
                            </form>
                        </div>
                    </div>
                    {#/foreach#}
                </div>
            </div><br/>
        </div>
        {#$pagelist#}
        <div class="pn_page">
            {#if !empty($reports_list_res.previous.id)#}
            <a href="javascript:void(0);" onclick="gopage({#$reports_list_res.previous.id#})" class="prev">
                <em class="tri"></em>
                <strong>上一頁：{#$reports_list_res.previous.title#}</strong>
            </a>
            {#else#}
            <a class="prev" style="background:none;"></a>
            {#/if#}
            {#if !empty($reports_list_res.next.id)#}
            <a href="javascript:void(0);" onclick="gopage({#$reports_list_res.next.id#})" class="next">
                <em class="tri"></em>
                <strong>下一頁：{#$reports_list_res.next.title#}</strong>
            </a>
            {#else#}
            <a class="next" style="background:none;"></a>
            {#/if#}
        </div>
    </div>
    <!-- main-->
    <div class="sidebar">
        {#show_block('b2',1,'','sidebar_ad')#}
        {#show_block('b1',2,'','sidebar_function')#}
        {#show_block('b3',0,'','sidebar_search')#}
        {#show_block('b13',0,'','sidebar_registation')#}
        {#show_block('b11',0,'','sidebar_new_try sidebar_new b_box')#}
        {#show_block('b6',0,'','sidebar_facebook')#}
    </div>
    <!-- sidebar -->

</div><!--body-->

<iframe id="iframe1" name="iframe1" style="display:none"></iframe>

<!--  遮罩層  -->
<div id="fullbg" ></div>
<div  class="irpopbox popbox b_box" id="dialog" style="z-index: 60;	display:none;">
    <div class="hd">
        <h2 class="ir ht" id=loginTextName><span id=loginText>iTRIAL 會員登入 REGISTRATION</span></h2>
        <a class="popclose" style="cursor:pointer" onclick="closeLB();">close</a>
    </div>
    <div class="bd">
        <div class="lbox">
            <p>會員名稱 USERNAME</p>
            <input type="text" class="ipt" name="email" id="email">
            <p class="tip" id="email_tip" style="display:none;">
                <em class="hack"></em>
                <a class="close" href="javascript:void(0);" onclick="$('#email_tip').hide();">close</a>
                {#php#}echo NO_USERNAME;{#/php#}
            </p>
            <p>密碼 PASSWORD</p>
            <input type="password" class="ipt" name="password" id="password">
            <p class="tip" id="password_tip" style="display:none;">
                <em class="hack"></em>
                <a class="close" href="javascript:void(0);" onclick="$('#password_tip').hide();"> close </a>
                {#php#}echo NO_PASSWORD;{#/php#}
            </p>
            <a class="btn_s btn_s_login" onclick="login()" style="cursor:pointer" id="login"><strong>login</strong></a>
            <ul>
                <li><a href="/member.php?action=forgetPassword">忘記密碼</a></li>
                <li><a href="/member.php?action=reg&toURL={#$thisUrl#}">註冊新帳號</a></li>
            </ul>
        </div>
        <div class="rbox">
            <div class="lgbox"><em class="hack"></em>
                <a class="fbtn ir" href="/member.php?action=login_facebook&toURL={#$thisUrl#}"><strong>以facebook登入</strong></a><span><a class="fb_link" href="/member.php?action=login_facebook&toURL={#$thisUrl#}">以facebook登入</a></span>
            </div>
            <div class="lgbox lgbox2" onClick="fnblogin()" id=login_type style="cursor:pointer" ><em class="hack"></em>
                <a class="fabtn ir" id=classlogo><strong>以F&amp;B登入</strong></a><span id=login_type_text  >以F&amp;B登入</span>
            </div>
        </div>
    </div>
</div>

<div style="top:400px;z-index:60;display:none;" class="apopbox popbox b_box" id="dialog_limits">
    <div class="hd">
        <h2 class="ir ht"><span>提示信息 ALERT</span></h2>
        <a class="popclose" onclick="closeLB();" style="cursor:pointer">close</a>            </div>
    <div class="bd">
        <p>你還未成為試用專員，<a href="/member.php?action=regTrial&toURL={#$thisUrl#}">立即申請</a>！</p>
        <a class="btn_b btn_s_im_back" href="javascript:void(0);" onclick="closeLB();"><strong>立即返回</strong></a>            </div>
</div>
<div style="top:400px;z-index:60;display:none;" class="apopbox popbox b_box" id="dialog_popup">
    <div class="hd">
        <h2 class="ir ht"><span>提示信息 ALERT</span></h2>
        <a class="popclose" onclick="closeLB();" style="cursor:pointer">close</a>            </div>
    <div class="bd">
        <p id="popupText"></p>
        <a class="btn_b btn_s_im_back" href="javascript:void(0);" onclick="closeLB();"><strong>立即返回</strong></a>            </div>
</div>
<script>
        function showpop(text){
            $("#fullbg").fadeIn();
            $("#dialog").fadeOut('slow');
            $("#dialog_limits").fadeOut('slow');
            showLB('#dialog_popup',0);
            $("#popupText").text(text);
        }

        $(document).ready(function(){

            $('#email').mousedown(check_register_email);
            $('#email').keyup(check_register_email);

            $('#password').mousedown(check_register_password);
            $('#password').keyup(check_register_password);

        });
        function check_register_email(){
            var rt = 0;
            if($('#email').val().length==0){
                $("#email_tip").addClass("tip").show();
            }else {
                $("#email_tip").removeClass("tip").hide();
                rt =  1;
            }
            return rt;
        }
        function check_register_password(){
            var rt = 0;
            if($('#email').val().length==0){
                $("#email_tip").addClass("tip").show();
            }else {
                $("#email_tip").removeClass("tip").hide();
                rt =  1;
            }
            return rt;
        }

        function check_cssby(tipmainname){

            var obj =$("#"+tipmainname+"_tip");
            if(obj.attr('class')!='tip'){
                return 1;
            }else{
                return 0;
            }
        }
        function check_register(){
            if($('#email').val().length==0){
                $('#email').focus();
                //alert("{#$NO_USERNAME#}");
                $('#email_tip').show();
                return false;
            }else if($('#password').val().length==0){
                $('#password').focus();
                //alert("{#$NO_PASSWORD#}");
                $('#password_tip').show();
                return false;
            }else{
                /*
                        var captcha=$('#captcha').val();
                        $.get("{#$selfurl#}?action=ajax_checkCaptcha",{captcha:captcha},function(data){
                                if(data=='false'){
                                        alert("{#$ERR_CAPTCHA#}");
                                        $('#captcha').focus();
                                        $('#captcha_img').attr("src","captcha.php?t="+Math.random());
                                        return false;
                                }else{
                                        $("#form1").submit();
                                }
                        });
                 */
                $("#form1").submit();
            }
        }
        $(document).ready(function(){
            $('#email').focus();
        });
</script>
{#include file="footer.php"#}